#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

class Student
{
public:
    Student(int num = 0, const string name = "")
        :_number(num)
        ,_name(name)
        ,_chinese(0)
        ,_math(0)
    {}

    bool setChinese(double score);
    bool setMath(double score);

    double getChinese() const { return _chinese; }
    double getMath() const { return _math; }
    double getAverage() const { return (_chinese + _math) / 2; }

    int getNumber() const { return _number; }
    const string& getName() const { return _name; }

private:
    int _number;
    string _name;
    double _chinese;
    double _math;
};
bool Student::setChinese(double score) 
{ 
    if (score < 0 || score > 100) return false;
    _chinese = score;
    return true;
}
bool Student::setMath(double score) 
{
    if (score < 0 || score > 100) return false;
    _math = score; 
    return true;
}

void findStudent(Student* stu, int n, string tgt)
{
    bool isNotFound = true;
    for (int i = 0; i < n; i++)
        if (stu[i].getName().find(tgt) != EOF)
        {
            cout << stu[i].getNumber() << ' '\
                << stu[i].getName() << ' '\
                << stu[i].getChinese() << ' '\
                << stu[i].getMath() << ' '\
                << stu[i].getAverage() << endl;
            isNotFound = false;
        }
    if (isNotFound) cout << "Not found." << endl;
}

int main()
{
    int n, i;
    int number;
    string name, searchName;
    double math, chinese;
    cin >> n;
    Student* stu = new Student[n];
    for (i = 0; i < n; i++)
    {
        cin >> number >> name >> chinese >> math;
        stu[i] = Student(number, name);
        stu[i].setChinese(chinese);
        stu[i].setMath(math);
    }
    cin >> searchName;  //输入需要查找的姓名
    findStudent(stu, n, searchName);  //调用函数，查找学生，输出信息
    delete[] stu;
    return 0;
}
